home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
8_6.lha
/
8_6
/
8_6_fbover.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
648b
|
39 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
/ Empty an output buffer.
include <limits.h>
nt filebuf::overflow(int c)
if (!opened || allocate() == EOF)
return EOF;
// unbuffered IO
if (base == eptr)
{
if (c != EOF)
{
*pptr = c;
if (putc(c, fp) != c)
return EOF;
}
}
// buffered IO
else
{
if (pptr > base)
if (fwrite(base, sizeof(char), pptr-base, fp) !=
pptr-base)
return EOF;
// reset the pointers and store the character
pptr = gptr = base;
if (c != EOF)
*pptr++ = c;
}
return (c & UCHAR_MAX);